package com.zrar.award.test;

import java.awt.Dimension;
import java.awt.Toolkit;

import javax.swing.JFrame;

public class SystemUtil {

	public static void showInCenter(JFrame frame) {
		// 显示位置
		int HEIGHT = frame.getHeight();
		int WIDTH = frame.getWidth();
		Toolkit kit = Toolkit.getDefaultToolkit();// 设置顶层容器框架为居中
		Dimension screenSize = kit.getScreenSize();
		int width = screenSize.width;
		int height = screenSize.height;
		int x = (width - WIDTH) / 2;
		int y = (height - HEIGHT) / 2;
		frame.setLocation(x, y);
	}
	
	public static boolean isInteger(String sum){
		String num_regex = "^[0-9]+$";		
		
		return sum.matches(num_regex);
	}
	
}
